package gold.digger;

import gold.vo.TreeNode;

import java.util.*;
import java.util.List;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC1261 {
    public long startExecuteTime = System.currentTimeMillis();


    class FindElements {

        TreeSet<Integer> dict = new TreeSet<>();

        public FindElements(TreeNode root) {
            buildDictRecur(root, 0);
        }

        public void buildDictRecur(TreeNode root, int val) {
            if (null == root) return;
            dict.add(val);
            buildDictRecur(root.left, 2 * val + 1);
            buildDictRecur(root.right, 2 * val + 2);
        }

        public boolean find(int target) {
            return this.dict.contains(target);
        }
    }

    public void run() {
        FindElements solution = new FindElements(null);
        List<Integer> list = new ArrayList<>();
        System.out.println(solution.toString());
    }

    public static void main(String[] args) throws Exception {
        LC1261 an = new LC1261();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
